package org.finesys.system.convert;

import java.util.List;

import org.finesys.system.api.dto.UserGiteeDto;
import org.finesys.system.api.entity.SysUserGitee;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * MapStruct对象转换方法
 */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SysUserGiteeConvert {

    SysUserGiteeConvert INSTANCE = Mappers.getMapper(SysUserGiteeConvert.class);

    /**
     * 转换AppDto为SysApp对象
     */
    SysUserGitee convert(UserGiteeDto userGiteeDto);

    /**
     * 转换SysApp为AppDto对象
     */
    UserGiteeDto convert(SysUserGitee sysUserGitee);

    /**
     * 数组转换
     */
    List<UserGiteeDto> convertList(List<SysUserGitee> list);

    /**
     * 分页对象转换
     */
    @Mappings({
            @Mapping(target = "optimizeJoinOfCountSql", ignore = true)
    })
    Page<UserGiteeDto> convertPage(Page<SysUserGitee> giteePage);
}
